package com.dsl.dslallinone.common.config;

import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
import io.swagger.v3.oas.models.servers.Server;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Arrays;

/**
 * Swagger配置
 */
@Configuration
public class SwaggerConfig {

    @Bean
    public OpenAPI customOpenAPI() {
        return new OpenAPI()
                .info(new Info()
                        .title("DSL All-in-One API")
                        .version("1.0.0")
                        .description("DSL查询系统API文档 - 支持复杂时间序列数据查询、实时数据获取、数据导出等功能")
                        .contact(new Contact()
                                .name("DSL Team")
                                .email("dsl@example.com")
                                .url("https://github.com/dsl/dslallinone"))
                        .license(new License()
                                .name("Apache 2.0")
                                .url("https://www.apache.org/licenses/LICENSE-2.0")))
                .servers(Arrays.asList(
                        new Server().url("http://localhost:8766").description("本地开发环境"),
                        new Server().url("https://api.dsl.com").description("生产环境")
                ));
    }
}
